﻿using CloudMusic.Model;
using System.Windows;
using System.Windows.Controls;
using static CloudMusic.View.PageFindMusic;

namespace CloudMusic.UC
{
    /// <summary>
    /// 首页推荐歌单 是否有每日推荐
    /// </summary>
    public class RecommdDataTemplateSelector: DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var fe = container as FrameworkElement;
            var obj = item as recommdData;
            DataTemplate dt = null;
            if (obj != null && fe != null)
            {
                if (obj.daysVis == Visibility.Visible)
                    dt = fe.FindResource("daysKey") as DataTemplate;
                else
                    dt = fe.FindResource("recoomdKey") as DataTemplate;

            }
            return dt;
        }
    }
    /// <summary>
    /// 歌单/精品歌单
    /// </summary>
    public class songsDataTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var fe = container as FrameworkElement;
            var obj = item as songSheetData;
            DataTemplate dt = null;
            if (obj != null && fe != null)
            {
                if (obj.jpVis == Visibility.Visible)
                    dt = fe.FindResource("jpKey") as DataTemplate;
                else
                    dt = fe.FindResource("songsKey") as DataTemplate;

            }
            return dt;
        }
    }
    /// <summary>
    /// 歌手/歌手排行
    /// </summary>
    public class singerDataTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var fe = container as FrameworkElement;
            var obj = item as singerMode;
            DataTemplate dt = null;
            if (obj != null && fe != null)
            {
                dt = fe.FindResource("singerKey") as DataTemplate;
            }
            return dt;
        }
    }
}
